<?php
/**
 * Created by PhpStorm.
 * User: DELL
 * Date: 2017/10/9
 * Time: 15:47
 */
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller{
    public function login(){
        if(IS_POST){
            $model =D('User');
            if($model->validate($model->_login_validate)->create()){
                if($model->login()){
                    $this->success('登录成功',U('Index/index'));
                    exit;
                }
            }
            $this->error($model->getError());
            exit;
        }
        $this->display();
    }
    public function logout(){
        session(null);
        redirect(U('admin/Login/login'));
    }
}